<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    x:Class="OpenLS.Spreadsheet.UI.SpreadsheetQuickAccessToolbar"
  xmlns:ssui="clr-namespace:OpenLS.Spreadsheet.UI;assembly=OpenLS.Spreadsheet.UI"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:oui="http://schemas.Kherty.com/office/2007"
                    xmlns:office="http://schemas.Kherty.com/office/2007/core"
                    xmlns:Internals="clr-namespace:OpenLS.Spreadsheet.UI.Internals"
    xmlns:media="clr-namespace:OpenLS.Media;assembly=OpenLS.Media"
    >
  <ResourceDictionary.MergedDictionaries>
    <oui:QuickAccessToolbarResources/>
  </ResourceDictionary.MergedDictionaries>

  <HierarchicalDataTemplate DataType="{x:Type office:ICompositeUndoUnit}" x:Key="actionTemplate">
    <TextBlock Text="{Binding Text}"/>
  </HierarchicalDataTemplate>

  <Menu DockPanel.Dock="Top" Background="Transparent" Margin="0" HorizontalAlignment ="Left"
        x:Key="{x:Static ssui:SpreadsheetWindowComponents.QuickAccessToolbarKey}" oui:RibbonElement.ControlState="Small"
        Style="{StaticResource {x:Static oui:Styles.QuickAccessToolbarStyleKey}}"
        DataContext="{Binding RelativeSource={RelativeSource Self}, Path=(ssui:SpreadsheetElement.Workbook)}">
    <Menu.Resources>
      <Style TargetType="{x:Type Image}">
        <Setter Property="Width" Value="16"/>
        <Setter Property="Height" Value="16"/>
      </Style>
    </Menu.Resources>
    <MenuItem Header="" Command="{x:Static ApplicationCommands.Save}" Padding="1">
    </MenuItem>
    <MenuItem Header="" Command="{x:Static ApplicationCommands.Undo}" ItemsSource="{Binding Path=UndoManager.UndoStack}" Tag="Small"
              ItemTemplate="{StaticResource actionTemplate}"  Padding="1" Icon="{media:Image Undo}">
      <MenuItem.ItemContainerStyle>
        <Style TargetType="{x:Type MenuItem}"  BasedOn="{StaticResource {x:Type MenuItem}}">
          <Setter Property="Command" Value="{x:Static ApplicationCommands.Undo}"/>
          <Setter Property="CommandParameter" Value="{Binding}"/>
        </Style>
      </MenuItem.ItemContainerStyle>
            <MenuItem.ItemsPanel>
                <ItemsPanelTemplate>
                    <Internals:InvertedStackPanel/>
                </ItemsPanelTemplate>
            </MenuItem.ItemsPanel>

        </MenuItem>
    <MenuItem Header="" Command="{x:Static ApplicationCommands.Redo}" Icon="{media:Image Redo}"  Padding="1" ItemsSource="{Binding Path=UndoManager.RedoStack}" Tag="Small" ItemTemplate="{StaticResource actionTemplate}">
      <MenuItem.ItemContainerStyle>
        <Style TargetType="{x:Type MenuItem}"  BasedOn="{StaticResource {x:Type MenuItem}}">
          <Setter Property="Command" Value="{x:Static ApplicationCommands.Redo}"/>
          <Setter Property="CommandParameter" Value="{Binding}"/>
        </Style>
      </MenuItem.ItemContainerStyle>
            <MenuItem.ItemsPanel>
                <ItemsPanelTemplate>
                    <Internals:InvertedStackPanel/>
                </ItemsPanelTemplate>
            </MenuItem.ItemsPanel>

        </MenuItem>
  </Menu>

</ResourceDictionary>